import os


PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
INI_PATH = os.path.join(PROJECT_PATH, 'pytest.ini')
REPORT_PATH = PROJECT_PATH + "/test_report/"
DATA_PATH = PROJECT_PATH + "/test_data/"


class RunConfig:
    """
    运行测试配置
    """
    # 运行测试用例的目录或文件
    cases_path = os.path.join(PROJECT_PATH, "test_cases")

    # 配置浏览器驱动类型(chrome/firefox/chrome-headless/firefox-headless)。
    driver_type = "chrome"

    # 配置运行的 URL
    url = "https://www.baidu.com"

    # 失败重跑次数
    rerun = "1"

    # 当达到最大失败数，停止执行
    max_fail = "3"

    # 浏览器驱动（不需要修改）
    driver = None

    # 报告路径（不需要修改）
    NEW_REPORT = None

    # 根目录
    BASE_DIR = os.path.dirname(os.path.abspath(__file__))


class DevConfig:
    """
    开发环境配置
    """
    config_path = os.path.join(PROJECT_PATH, 'config', 'dev.yaml')


class TestConfig:
    """
    测试环境配置
    """
    config_path = os.path.join(PROJECT_PATH, 'config', 'test.yaml')


class UriConfig:
    """
    接口路径配置,请以/开头
    """
    USER_INTERFACE_LOGIN_URI = '/v1/login'
    RABBIT_PLATFORM_LOGIN_URI = '/public/login'
    RABBIT_PLATFORM_QUERY_API_URI = '/public/api/listPage'


env = {
    "test": TestConfig,
    "dev": DevConfig
}
